//
//  CalculatorTableViewCell.swift
//  koolcar
//
//  Created by kuaimaxiansheng on 2023/10/17.
//

import UIKit

protocol CalculatorTableViewCellDelegate {
    func selectCarCalculatorAntion()
}

class CalculatorTableViewCell: UITableViewCell {
    var delegate :CalculatorTableViewCellDelegate!
    var carCalculatorBtn: UIButton!
    var contentModel: CarDetailsContentModel!//model
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.selectionStyle = .none
        self.backgroundColor = .white
        self.clipsToBounds = true
        self.initUI()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func initUI(){
       
        
        self.carCalculatorBtn = UIButton(frame: .zero)
        self.carCalculatorBtn.backgroundColor = UIColor(hex: 0xFFCC32 ,alpha: 0.15)
        self.carCalculatorBtn.layer.cornerRadius = 8
        self.carCalculatorBtn.clipsToBounds = true
        self.carCalculatorBtn.setTitleColor(Theme.titleLabColor, for: .normal)
        self.carCalculatorBtn.titleLabel?.font = UIFont(name: Theme.PingFangSCMedium, size: 14)
        self.carCalculatorBtn.setTitle(MMLocalizedString("car_shopping_calculator", comment: "购车计算器"), for: .normal)
        self.carCalculatorBtn.addTarget(self, action: #selector(carCalculatorBtnAntion), for: .touchUpInside)
        self.contentView.addSubview(self.carCalculatorBtn)
        
        self.carCalculatorBtn.snp.makeConstraints { make in
            make.top.equalTo(10)
            make.left.equalTo(14)
            make.right.equalTo(-14)
            make.height.equalTo(40)
            make.bottom.equalTo(0)
        }
    }
   
   
    
    
    
    //MARK: - Antion
    @objc func carCalculatorBtnAntion(){
        self.delegate?.selectCarCalculatorAntion()
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

}
